#include <linux/fs.h>
#include <sys/mman.h>
#include <stdio.h>
#include <error.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "keyBoard.h"

Int32 gfd_key;
Int32 key_init(void)
{

	gfd_key=open("/dev/key",O_RDWR);
   	if(gfd_key==-1)
	{	
		printf("ap-key:/dev/key can not open.\n");
		return(-1);
	}
	return(0);
}
Uint8 get_key(void)
{
	Uint8 key;
	read(gfd_key,&key,1); 
//	if(key)
//		printf("key=%c\n",key);
	return key;
}
void scan_keyboard(void)
{
	Uint8 key;
	while(1)
	{
		write(gfd_key,&key,1);
		usleep(20000);
	}
	printf("key_pthread exit\n");
}



